public class Fish {
//
////    public Fish(String name, int age) {
////        super(name, age);
////    }
////
////    public void eat() {
////        System.out.println(this.name + "正在吃鱼粮");
////    }
////
////    public void drink() {
////        System.out.println(this.name + "喝水");
////    }
//
    public static void main(String[] args) {
//        int[] ages = {20, 30, 40, 50};
//        for (int i = 0; i < ages.length; i++) {
//            System.out.println(ages[i]);
//        }

                int[] ages = {20, 30, 40, 50};
                for(int x : ages) {
                    System.out.println(x);
                }

    }
        //        int[] ages = {20, 30, 40, 50};

//
//
}

//数组名[索引]
//
////取值
//System.out.println(arr[0]);  // 12
//
////赋值
//arr[2] = 100;
//System.out.println(arr[2]);  // 100
//
//// 获取数组的长度（也就是数组元素的个数）
//System.out.println(arr.length);  // 3
//
//数组的最大索引是：数组名.length - 1  // 前提是元素个数大于 0
//
//int[] ages = {20, 30, 40, 50};

